package cn.wolfcode.trip.base.mapper;

import cn.wolfcode.trip.base.domain.Travel;
import cn.wolfcode.trip.base.domain.User;
import cn.wolfcode.trip.base.query.QueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface UserMapper {

    int insert(User entity);

    User selectByPrimaryKey(Long id);

    List<User> selectAll();

    int updateByPrimaryKey(User entity);

    /**
     * 通过邮箱和密码查询
     * @param email
     * @param password
     * @return
     */
    User selectByEmailAndPassword(@Param("email") String email,
                                  @Param("password") String password);

    /**
     * 高查
     * @param qo
     * @return
     */
    List<User> selectForList(QueryObject qo);

    /**
     * 根据用户的id查找对应的游记总条数
     * @param userId
     * @return
     */
    int selectCountTravelById(Long userId);

    /**
     * 根据用户的id查找对应的游记评论总条数
     * @param userId
     * @return
     */
    int selectTravelCommendCountTravelById(Long userId);
    /**
     * 根据用户的id查找对应的攻略评论总条数
     * @param userId
     * @return
     */
    int selectStrategyCommendCountStrategyById(Long userId);
}